﻿

namespace K9Nano.Updater.Pipes;

public class PostInstallPipe : CommandPipeBase
{
    protected override string? GetCommand(ReleaseMetadata package) => package.PostCommand;

    protected override string? GetCommandArgs(ReleaseMetadata package) => package.PostCommandArgs;

    protected override async Task InvokeCoreAsync(UpdateContext context, CancellationToken cancellation)
    {
        await base.InvokeCoreAsync(context, cancellation);

        // 当前步骤完后，更新结束
        context.Success = ExitCode == null || ExitCode == 0;
    }
}
